<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script>
    $(document).ready(function(){
        $("#contentTable").treeTable();
    });
    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#settleSearch").submit();
        return false;
    }
    function print(rcptNo){
        printPdf('${ctx}/fiance/inpSettleMaster/settlePrint','rcptNo='+rcptNo);
    }
</script>
<div class="app">
        <div class="content-wrap">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#">住院结算查询</a>
                </li>
            </ul>
            <div class="row" id="topDivId">
                    <section class="panel">
                        <div class="panel-body">
                            <div class="table-responsive no-border">
                                <div class="datatable-top">
                                    <div class="pull-left">
                                        <form id="settleSearch"  onsubmit="return loadDivForm('mainCenterDiv','settleSearch','${ctx}/fiance/inpSettleMaster/settleSearch');" method="post" class="form-inline">
                                            <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                            <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                                            <label>结算日期：</label><input name="startTime" value="${inpSettleMaster.startTime}"  id="startTime"  class="form-control Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>&nbsp;至
                                            <input name="endTime" value="${inpSettleMaster.endTime}" id="endTime"  class="form-control Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
                                            <label>收费人:</label><input name="createBy.name" value="${inpSettleMaster.createBy.name}" class="form-control">
                                            &nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
                                        </form>
                                    </div>
                                </div>
                            <table id="contentTable" class="table table-bordered mg-t datatable">
                                <thead>
                                  <tr>
                                      <th>收据号</th>
                                      <th>病人标识</th>
                                      <th>病人姓名</th>
                                      <th>结算日期</th>
                                      <th>结算人</th>
                                      <th>发票号</th>
                                      <th>总费用</th>
                                      <th>应缴费用</th>
                                      <th>实收费用</th>
                                      <th>操作</th>
                                  </tr>
                                </thead>
                                <tbody>
                                 <c:forEach items="${page.list}" var="settleMaster" varStatus="ma">
                                   <tr id="${settleMaster.id}">
                                       <td>${settleMaster.rcptNo}</td>
                                       <td>${settleMaster.patVisit.visitNo}</td>
                                       <td>${settleMaster.patVisit.patVisitIndex.name}</td>
                                       <td><fmt:formatDate value="${settleMaster.createDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
                                       <td>${settleMaster.user.name}</td>
                                       <td></td>
                                       <td>${settleMaster.costs}</td>
                                       <td>${settleMaster.charges}</td>
                                       <td>${settleMaster.charges}</td>
                                       <td><a href="#" id="btnPrint" class="btn btn-success btn-xs" onclick="print('${settleMaster.rcptNo}');">打印</a></td>
                                   </tr>
                                     <c:if test="${settleMaster.inpSettleDetailList.size()>0}">
                                         <tr id="${ma.count}" pid="${settleMaster.id}">
                                             <td colspan="6">
                                                 <table class="table table-bordered mg-t">
                                                     <tr>
                                                         <th>序号</th>
                                                         <th>收费类型</th>
                                                         <th>应收</th>
                                                         <th>实收</th>
                                                     </tr>
                                                     <c:forEach items="${settleMaster.inpSettleDetailList}" var="detail" varStatus="ss">
                                                         <tr>
                                                             <td> ${ss.count}</td>
                                                             <td> ${fns:getDictLabels(detail.feeClass, 'TALLY_SUBJECT_DICT', '')}</td>
                                                             <td> ${detail.costs}</td>
                                                             <td> ${detail.payments}</td>
                                                         </tr>
                                                     </c:forEach>
                                                 </table>
                                             </td>
                                         </tr>
                                     </c:if>
                                 </c:forEach>
                                </tbody>
                            </table>
                            <div class="pagination">${page}</div>
                         </div>
                        </div>
                    </section>
            </div>
        </div>
</div>
</div>
</div>